<template>
    <el-input :modelValue="userName" @update:modelValue="handleInput"></el-input>
    <button @click="handleSubmit">测试提交</button>
</template>

<script setup>
import { ref } from 'vue';

const props = defineProps({
    modelValue: {
        type: String,
    },
});
const emits = defineEmits(['handleSubmit', 'update:modelValue']);
let userName = ref(props.modelValue);
const handleSubmit = () => {
    emits('handleSubmit', userName);
};
const handleInput = value => {
    userName.value = value;
    emits('update:modelValue', value);
};
</script>

<style lang="scss" scoped></style>
